////
////  OrderViewController.m
////  UEAssistant
////
////  Created by mac on 2017/1/21.
////  Copyright © 2017年 youyixinxi. All rights reserved.
////
//
#import "OrderWaitViewController.h"
//#import "OrderTableViewCell.h"
//#import "LoginViewController.h"
//#import "OrderDetailViewController.h"
//#import "NetworkTools.h"
//#import "FillLabelView.h"
//#import "PlatWaitModel.h"
//#import "AboutJeemaaViewController.h"
//#import "OrderBaseControl.h"
//
//@interface OrderWaitViewController ()<UITableViewDelegate,UITableViewDataSource,UIAlertViewDelegate>{
//    
//    NSMutableArray              *_dataSource;
//    NSInteger                   _currentPage;
//}
//
//@property (nonatomic, strong) NSURLSessionTask                              *task_wait_firstLoad;
//@property (nonatomic, strong) NSURLSessionTask                              *task_wait_becomeUpdate;
//@property (nonatomic, strong) NSURLSessionTask                              *task_wait_loadNewData;
//@property (nonatomic, strong) NSURLSessionTask                              *task_wait_loadMoreData;
//@property (nonatomic, strong) NSURLSessionTask                              *task_wait_historyOrder;
//@property (nonatomic, strong) NSURLSessionTask                              *task_wait_changeSegement;
//@property (nonatomic, strong) NSURLSessionTask                              *task_wait_readDetail;
//
//@property (nonatomic, strong) UITableView                                   *tableView;
//@property (nonatomic, strong) NetworkTools                                  *networkTool;
//@property (nonatomic, strong) UIImageView                                   *view_data_nil;
//@property (nonatomic, strong) UILabel                                       *text_data_nil;
//@property (nonatomic, strong) UILabel                                       *label;
//
//@end
//
@implementation OrderWaitViewController
//
//- (void)dealloc{
//
//    [_networkTool removeObserver:self forKeyPath:@"orderList" context:nil];
//    [_networkTool removeObserver:self forKeyPath:@"platOrderList" context:nil];
//
//    [JeemaaNotificationCenter removeObserver:self name:@"refreshOrderList" object:nil];
//    [JeemaaNotificationCenter removeObserver:self name:@"hiddenLSProgressHUD" object:nil];
//    [JeemaaNotificationCenter removeObserver:self name:@"loginOffClearData" object:nil];
//    [JeemaaNotificationCenter removeObserver:self name:@"exchangeSegementAndReloadData_wait" object:nil];
//}
//
//- (void)viewWillAppear:(BOOL)animated{
//    [super viewWillAppear:animated];
//}
//
//- (void)viewDidLoad {
//    [super viewDidLoad];
//    [self initlizeUserface];
//    [self initlizeDataSource];
//    [self setupNetworkTools];
//    [self getOrderData];
//    [self registerNotification];
//}
//
//- (void)initlizeUserface{
//
//    [self.view addSubview:self.tableView];
//    self.tableView.rowHeight =  UITableViewAutomaticDimension;
//    self.tableView.estimatedRowHeight = 150;
//    self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
//    self.tableView.scrollIndicatorInsets = self.tableView.contentInset;
//    [YhxUtility setExtraCellLineHidden:self.tableView];
//
//    self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewTopic)];
//    self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreTopic)];
//    self.tableView.mj_header.automaticallyChangeAlpha = YES;
//    self.tableView.mj_footer.automaticallyChangeAlpha = YES;
//    self.tableView.mj_header.backgroundColor = RGB(245, 246, 247, 1);
//}
//
//- (void)initlizeDataSource{
//
//    _currentPage = 1;
//    _dataSource = [NSMutableArray array];
//}
//
//- (void)setupNetworkTools{
//
//    _networkTool = [[NetworkTools alloc]init];
//    [_networkTool addObserver:self forKeyPath:@"orderList" options:NSKeyValueObservingOptionNew context:nil];
//    [_networkTool addObserver:self forKeyPath:@"platOrderList" options:NSKeyValueObservingOptionNew context:nil];
//}
//
//- (void)registerNotification{
//
//    [JeemaaNotificationCenter addObserver:self selector:@selector(applicationDidBecomeActive) name:UIApplicationDidBecomeActiveNotification object:nil];
//    [JeemaaNotificationCenter addObserver:self selector:@selector(loadNewTopic) name:@"refreshOrderList" object:nil];
//    [JeemaaNotificationCenter addObserver:self selector:@selector(hiddenYHXLoadingAnimation) name:@"hiddenLSProgressHUD" object:nil];
//    [JeemaaNotificationCenter addObserver:self selector:@selector(loadDataByDifSegementIndexInOrderSingle:) name:@"exchangeSegementAndReloadData_wait" object:nil];
//    [JeemaaNotificationCenter addObserver:self selector:@selector(clearDataWhenLoginoutSuccess) name:@"loginOffClearData" object:nil];
//
//}
//
//- (void)getOrderData{
//
//    if ([UserDefaults objectForKey:@"account"]) {
//
//        [JeemaaNotificationCenter postNotificationName:@"changeHead" object:nil];
//        [LSProgressHUD showLoadingToView:self.view];
//        if (shareData.loginByLoginViewcontroller) {
//            //手动登录
//            NSDictionary *dic = @{@"pageSize":@"8",@"pageNum":@"1"};
//            _task_wait_firstLoad = [_networkTool getOrderListDataWithParam:dic];
//        }
//        else{//自动登录
//            [self autologin_GetOrderList_launchType:launchTypeBekilled];
//        }
//    }
//    else{//推出登录界面
//        AppDelegate *tempAppDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
//        LoginViewController *loginVC = [[LoginViewController alloc]init];
//        [tempAppDelegate.window.rootViewController presentViewController:loginVC animated:YES completion:nil];
//    }
//}
//
////程序从后台唤醒进去前台时再登录一次（防止session丢失），注意判断登录方式launchType
//- (void)applicationDidBecomeActive{
//
//    if ([UserDefaults objectForKey:@"account"] && [UserDefaults objectForKey:@"password"]) {
//        /*程序活跃时清空数据，显示HUD
//        [_dataSource removeAllObjects];
//        [self.tableView reloadData];
//        [LSProgressHUD showLoadingToView:self.view];
//         */
//        if(shareData.loginByLoginViewcontroller) return;
////        _task_wait_becomeUpdate = [self autologin_GetOrderList_launchType:launchTypeFromBackground];
//    }
//    //检查用户是否允许通知
//    [YhxUtility checkUSerIfAllowNotification];
//
//}
//
//- (void)autologin_GetOrderList_launchType:(launchType)launchType{
//
//    if (![UserDefaults objectForKey:@"deviceToken"]) {
//        [UserDefaults setObject:@"tempToken" forKey:@"deviceToken"];
//    }
//    NSDictionary *dic = @{@"userName":[UserDefaults objectForKey:@"account"],
//                          @"userPwd":[UserDefaults objectForKey:@"password"],
//                          @"deviceToken":[UserDefaults objectForKey:@"deviceToken"],
//                          @"deviceModel":[UserDefaults objectForKey:@"phoneModel"]};
//
//    [AvailableNetWorking postWithUrl:login_connector params:dic successHandler:^(id responseObject) {
//        
//        if ([responseObject[@"code"] intValue] == 200) {
//
////            TGLog(@"userInfo ----- %@",responseObject[@"result"]);
//            orderSingleton.isPoolTranslator = [responseObject[@"result"][@"isPoolTranslator"] integerValue];
//            shareData.userNick = responseObject[@"result"][@"userNick"];
//            shareData.headURL = responseObject[@"result"][@"facePath"];
//            [JeemaaNotificationCenter postNotificationName:@"changOrderHead" object:nil];
//            [JeemaaNotificationCenter postNotificationName:@"changeHead" object:nil];
//            _currentPage = 1;
//            switch (launchType) {//判断是以哪种方式启动程序
//                case launchTypeBekilled:
//                {
//                    NSDictionary *dic = @{@"pageSize":@"8",@"pageNum":@"1"};
//                    _task_wait_firstLoad = [_networkTool getOrderListDataWithParam:dic];
//                }
//                    break;
//                case launchTypeFromBackground:
//                {
//                    if (orderSingleton.segementIndex == 0)
//                    {
//                        //团队待抢单
//                        NSDictionary *dic = @{@"pageSize":@"8",@"pageNum":@"1"};
//                        _task_wait_firstLoad = [_networkTool getOrderListDataWithParam:dic];
//                    }
//                    else{
//                        if (orderSingleton.isPoolTranslator == 0)
//                        {
//                            [self.tableView addSubview:self.label];
//                        }
//                        else
//                        {
//                            //平台待抢单
//                            NSDictionary *dic = @{@"pageSize":@"8",@"pageNum":@"1"};
//                            _task_wait_firstLoad = [_networkTool getPlatOrderListDataWithParam:dic];
//                        }
//                    }
//                }
//                    break;
//                default:
//                    break;
//            }
//        }else{
//            [self repeateLoginAfterpswBechangedWithText:@"账号或密码不正确，请重新登录"];
//            [LSProgressHUD hiddenLoading:self.view];
//        }
//    } falureHandler:^(NSError *error) {
//        [LSProgressHUD hiddenLoading:self.view];
//    }];
//}
//
//#pragma mark PC端密码被修改后，重新登录
//- (void)repeateLoginAfterpswBechangedWithText:(NSString *)text{
//
//    [TopAlertView SetUpbackgroundColor:AlertRedColor andStayTime:2.0 andImageName:@"imagePlaceholder" andTitleStr:text andTitleColor:[UIColor whiteColor] andCancel:NO];
//    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//        //通知首页恢复默认segementIndex----
//        [JeemaaNotificationCenter postNotificationName:@"recover" object:nil];
//        AppDelegate *tempAppDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
//        LoginViewController *loginVC = [[LoginViewController alloc]init];
//        [tempAppDelegate.window.rootViewController presentViewController:loginVC animated:YES completion:nil];
//
//    });
//}
//
//#pragma mark -- observeValueForKeyPath
//- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{
//
//    if ([keyPath isEqualToString:@"orderList"]) {//团队待抢单
//
//        TGLog(@"orderList == %@",_networkTool.orderList);
//        NSArray *newOrders = [NSArray arrayWithArray:_networkTool.orderList];
//        if (newOrders.count < 8) {
//            //插入历史订单
//            orderSingleton.historyCount = 8 - newOrders.count;
//            NSDictionary *dic = @{@"pageSize":[NSString stringWithFormat:@"%ld",(long)orderSingleton.historyCount],@"pageNum":@"1"};
//            _task_wait_historyOrder = [AvailableNetWorking postWithUrl:[YhxUtility replaceTypePath:historyList_connector] params:dic successHandler:^(id responseObject) {
//
//                [_dataSource removeAllObjects];
//                if ([responseObject[@"code"] intValue] == 200) {
//                    NSArray *arr = [NSArray arrayWithArray:responseObject[@"result"]];
//                    if (orderSingleton.historyCount != arr.count) {
//                        orderSingleton.historyCount = arr.count;
//                    }
//                    int index = 0;
//                    for (int i = 0; i < newOrders.count; i++) {
//                        NSDictionary *dic = newOrders[i];
//                        TeamWaitModel *model = [[TeamWaitModel alloc]initWithDictionary:dic];
//                        model.indexPath_row = i;
//                        model.OrderTotelCount = newOrders.count + ((NSArray *)responseObject[@"result"]).count;
//                        [_dataSource addObject:model];
//                        index = i;
//                    }
//                    for (int i = 0; i < ((NSArray *)responseObject[@"result"]).count; i++) {
//                        NSDictionary *dic = responseObject[@"result"][i];
//                        TeamWaitModel *model = [[TeamWaitModel alloc]initWithDictionary:dic];
//                        model.indexPath_row = index + i + 1;
//                        model.OrderTotelCount = newOrders.count + ((NSArray *)responseObject[@"result"]).count;
//                        [_dataSource addObject:model];
//                    }
//                    [self.tableView reloadData];
//                    [LSProgressHUD hiddenLoading:self.view];
//                    [self.tableView.mj_header endRefreshing];
//                    [self judgeDataIsNilOfOrderList];
//                }else{
//
//                    [self.tableView reloadData];
//                    [TopAlertView SetUpbackgroundColor:AlertRedColor andStayTime:2.0 andImageName:@"imagePlaceholder" andTitleStr:responseObject[@"message"] andTitleColor:[UIColor whiteColor] andCancel:NO];
//                    [LSProgressHUD hiddenLoading:self.view];
//                    [self.tableView.mj_header endRefreshing];
//
//                }
//            } falureHandler:^(NSError *error) {
//
//                [self.tableView reloadData];
//                [LSProgressHUD hiddenLoading:self.view];
//                [self.tableView.mj_header endRefreshing];
//
//            }];
//        }
//        else{
//            orderSingleton.historyCount = 0;
//            [_dataSource removeAllObjects];
//            for (int i = 0; i < ((NSArray *)_networkTool.orderList).count; i++) {
//                NSDictionary *dic = ((NSArray *)_networkTool.orderList)[i];
//                TeamWaitModel *model = [[TeamWaitModel alloc]initWithDictionary:dic];
//                model.indexPath_row = i;
//                model.OrderTotelCount = ((NSArray *)_networkTool.orderList).count;
//                [_dataSource addObject:model];
//            }
//            [self.tableView reloadData];
//            [LSProgressHUD hiddenLoading:self.view];
//            [self.tableView.mj_header endRefreshing];
//            [self judgeDataIsNilOfOrderList];
//        }
//
//    }
//    else if ([keyPath isEqualToString:@"platOrderList"]){//平台待抢单
//
//        TGLog(@"platOrderList == %@",_networkTool.platOrderList);
//        if (orderSingleton.isPoolTranslator == 0) {
//            [_dataSource removeAllObjects];
//            [self.tableView reloadData];
//            self.tableView.separatorColor = RGB(233, 233, 233, 1);
//            [self.tableView addSubview:self.label];
//            [self.view_data_nil removeFromSuperview];
//            [self.text_data_nil removeFromSuperview];
//            [self.tableView addSubview:self.view_data_nil];
//            [self.tableView.mj_header endRefreshing];
//
//        }else{
//            [_dataSource removeAllObjects];
//            for (int i = 0; i < ((NSArray *)_networkTool.platOrderList).count; i++) {
//                NSDictionary *dic = _networkTool.platOrderList[i];
//                PlatWaitModel *model = [[PlatWaitModel alloc]initWithDictionary:dic];
//                [_dataSource addObject:model];
//            }
//            [self.tableView reloadData];
//            [LSProgressHUD hiddenLoading:self.view];
//            [self.tableView.mj_header endRefreshing];
//            [self judgeDataIsNilOfOrderList];
//
//        }
//    }
//}
//
//#pragma mark -- OrderBaseControlDelegate
//- (void)loadDataByDifSegementIndexInOrderSingle:(OrderSingle *)single{
//
//    _currentPage = 1;
//    [self cancelLastSessionTask];
//    [LSProgressHUD showLoadingToView:self.view];
//    switch (orderSingleton.segementIndex) {
//        case 0://选择了团队,更新团队数据
//        {
//            self.tableView.separatorColor = RGB(233, 233, 233, 1);
//            [self.label removeFromSuperview];
//            self.tableView.separatorColor = [UIColor clearColor];
//            [self.view_data_nil removeFromSuperview];
//            [self.text_data_nil removeFromSuperview];
//            NSDictionary *dic = @{@"pageSize":@"8",
//                                  @"pageNum":@"1"};
//            _task_wait_changeSegement = [_networkTool getOrderListDataWithParam:dic];
//        }
//            break;
//        case 1://选择了平台，更新平台数据
//        {
//
//            self.tableView.separatorColor = [UIColor clearColor];
//            if (orderSingleton.isPoolTranslator == 0) {
//
//                [self.tableView addSubview:self.label];
//                [self.view_data_nil removeFromSuperview];
//                [self.text_data_nil removeFromSuperview];
//                [self.tableView addSubview:self.view_data_nil];
//                [LSProgressHUD hiddenLoading:self.view];
//
//            }else{
//                self.tableView.separatorColor = [UIColor clearColor];
//                [self.view_data_nil removeFromSuperview];
//                [self.text_data_nil removeFromSuperview];
//                NSDictionary *dic = @{@"pageSize":@"8",
//                                      @"pageNum":@"1"};
//                _task_wait_changeSegement = [_networkTool getPlatOrderListDataWithParam:dic];
//            }
//
//        }
//        default:
//            break;
//    }
//}
//
//#pragma <UITableViewDelegate,UITableViewDataSource>
//- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
//
//    return 1;
//}
//
//- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
//
//    return _dataSource.count;
//}
//
//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
//
//    if (orderSingleton.segementIndex == 0) {
//        return ((TeamWaitModel *)_dataSource[indexPath.row]).cellHeight;
//    }else{
//        return ((PlatWaitModel *)_dataSource[indexPath.row]).cellHeight;
//    }
//}
//
//- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
//
//    OrderTableViewCell *cell = [OrderTableViewCell cellWithTableView:tableView];
//    if (orderSingleton.segementIndex == 0) {
//        [cell dispatchData:_dataSource[indexPath.row] cellModelType:ModelTypeTeamWait];
//    }else{
//        [cell dispatchData:_dataSource[indexPath.row] cellModelType:ModelTypePlatWait];
//    }
//    return cell;
//}
//
//- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
//
//    [tableView deselectRowAtIndexPath:indexPath animated:NO];
//    self.hidesBottomBarWhenPushed = YES;
//    if (orderSingleton.segementIndex == 0) {//来自团队
//
//        if (indexPath.row + 1 > _dataSource.count - orderSingleton.historyCount - 1 + 1) {
//            self.hidesBottomBarWhenPushed = NO;
//        }else{
//            if (indexPath.row > _dataSource.count - 1) {
//                [TopAlertView SetUpbackgroundColor:AlertRedColor andStayTime:2.0 andImageName:@"imagePlaceholder" andTitleStr:@"数据异常，请稍后再试" andTitleColor:[UIColor whiteColor] andCancel:NO];
//                self.hidesBottomBarWhenPushed = NO;
//            }else{
//                OrderDetailViewController *detailVC = [[OrderDetailViewController alloc]init];
//
//                //传递下一个页面的数据源
//                NSMutableArray *dataNew = [NSMutableArray array];
//                [dataNew addObject:((TeamWaitModel *)_dataSource[indexPath.row]).projectName];
//                [dataNew addObject:((TeamWaitModel *)_dataSource[indexPath.row]).deadLineTime];
//                [dataNew addObject:((TeamWaitModel *)_dataSource[indexPath.row]).taskName];
//                [dataNew addObject:[NSString stringWithFormat:@"%@ -> %@",((TeamWaitModel *)_dataSource[indexPath.row]).sourceLangValue,((TeamWaitModel *)_dataSource[indexPath.row]).targetLangValue]];
//                [dataNew addObject:[NSString stringWithFormat:@"%@字",((TeamWaitModel *)_dataSource[indexPath.row]).wordCount]];
//                [dataNew addObject:((TeamWaitModel *)_dataSource[indexPath.row] ).taskType];
//                [dataNew addObject:((TeamWaitModel *)_dataSource[indexPath.row]).labels];
//                NSString *memo;
//                if ([((TeamWaitModel *)_dataSource[indexPath.row]).memo isEqual:[NSNull null]]) {
//                    memo = @"";
//                }else{
//                    memo = ((TeamWaitModel *)_dataSource[indexPath.row]).memo;
//                }
//                [dataNew addObject:memo];
//                detailVC.dataSource = dataNew;
//
//                //属性
//                detailVC.sectorId = [NSString stringWithFormat:@"%@",((TeamWaitModel *)_dataSource[indexPath.row]).sectorId];
//                detailVC.ownerId = [NSString stringWithFormat:@"%@",((TeamWaitModel *)_dataSource[indexPath.row]).ownerId];
//                detailVC.taskId = [NSString stringWithFormat:@"%@",((TeamWaitModel *)_dataSource[indexPath.row]).taskId];
//                detailVC.projectName = ((TeamWaitModel *)_dataSource[indexPath.row]).projectName;
//                detailVC.vmId = [NSString stringWithFormat:@"%@",((TeamWaitModel *)_dataSource[indexPath.row]).vmId];
//                detailVC.taskName = ((TeamWaitModel *)_dataSource[indexPath.row]).taskName;
//                detailVC.docName = ((TeamWaitModel *)_dataSource[indexPath.row]).taskName;
//                detailVC.orderType = ((TeamWaitModel *)_dataSource[indexPath.row]).taskType;
//                [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
//                [self.navigationController pushViewController:detailVC animated:YES];
//                self.hidesBottomBarWhenPushed = NO;
//
//                NSDictionary *dic = @{@"sectorId":((TeamWaitModel *)_dataSource[indexPath.row]).sectorId,
//                                      @"ownerId":((TeamWaitModel *)_dataSource[indexPath.row]).ownerId,
//                                      @"taskId":((TeamWaitModel *)_dataSource[indexPath.row]).taskId};
//                //查看后取消蓝点
//                [AvailableNetWorking postWithUrl:[YhxUtility replaceTypePath:readDetail_connector] params:dic successHandler:^(id responseObject) {
//
//                    if ([responseObject[@"code"] intValue] == 200) {
//                        if (_dataSource.count > 8) {
//                            [_dataSource removeAllObjects];
//                            [self.tableView reloadData];
//                            _currentPage = 1;
//                        }
//                        NSDictionary *dic = @{@"pageSize":@"8",
//                                              @"pageNum":@"1"};
//                        _task_wait_readDetail = [_networkTool getOrderListDataWithParam:dic];
//
//                    }
//                } falureHandler:^(NSError *error) {
//
//                }];
//            }
//        }
//
//    }else{//来自平台
//
//        if (indexPath.row > _dataSource.count - 1) {
//
//            [TopAlertView SetUpbackgroundColor:AlertRedColor andStayTime:2.0 andImageName:@"imagePlaceholder" andTitleStr:@"数据异常，请稍后再试" andTitleColor:[UIColor whiteColor] andCancel:NO];
//            self.hidesBottomBarWhenPushed = NO;
//        }else{
//
//            OrderDetailViewController *detailVC = [[OrderDetailViewController alloc]init];
//
//            //传入下一个页面要用到的数据---
//            NSMutableArray *dataNew = [NSMutableArray array];
//            [dataNew addObject:((PlatWaitModel *)_dataSource[indexPath.row]).project_name];
//            [dataNew addObject:((PlatWaitModel *)_dataSource[indexPath.row]).deadline_time];
//            [dataNew addObject:((PlatWaitModel *)_dataSource[indexPath.row]).project_name];
//            [dataNew addObject:[NSString stringWithFormat:@"%@ -> %@",((PlatWaitModel *)_dataSource[indexPath.row]).sourcelangname,((PlatWaitModel *)_dataSource[indexPath.row]).targetlangname]];
//            [dataNew addObject:[NSString stringWithFormat:@"%@字",((PlatWaitModel *)_dataSource[indexPath.row]).wordcount]];
//            if ([((PlatWaitModel *)_dataSource[indexPath.row]).tasktype integerValue] == 1 ) {
//                [dataNew addObject:@"翻译"];
//                detailVC.orderType = @"翻译";
//            }else if ([((PlatWaitModel *)_dataSource[indexPath.row]).tasktype integerValue] == 2){
//                detailVC.orderType = @"编辑";
//                [dataNew addObject:@"编辑"];
//            }else{
//                detailVC.orderType = @"校对";
//                [dataNew addObject:@"校对"];
//            }
//            NSMutableArray *types = @[].mutableCopy;
//            NSArray *tempArr = [((PlatWaitModel *)_dataSource[indexPath.row]).label_idname_list componentsSeparatedByString:@","];
//            [tempArr enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
//                [types addObject:[obj substringFromIndex:NSMaxRange([obj rangeOfString:@"_"])]];
//            }];
//            [dataNew addObject:[types componentsJoinedByString:@"、"]];
//            NSString *memo;
//            if ([((PlatWaitModel *)_dataSource[indexPath.row]).memo isEqual:[NSNull null]]) {
//                memo = @"";
//            }else{
//                memo = ((PlatWaitModel *)_dataSource[indexPath.row]).memo;
//            }
//            [dataNew addObject:memo];
//            detailVC.dataSource = dataNew;
//
//            detailVC.plattask_id = [NSString stringWithFormat:@"%@",((PlatWaitModel *)_dataSource[indexPath.row]).plattask_id];
//            detailVC.docName = ((PlatWaitModel *)_dataSource[indexPath.row]).doc_name;
//            detailVC.vmId = [NSString stringWithFormat:@"%@",((PlatWaitModel *)_dataSource[indexPath.row]).vm_id];
//            detailVC.taskName = ((PlatWaitModel *)_dataSource[indexPath.row]).doc_name;
//
//            [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
//            [self.navigationController pushViewController:detailVC animated:YES];
//            self.hidesBottomBarWhenPushed = NO;
//
//            NSDictionary *dic = @{@"platTaskId":((PlatWaitModel *)_dataSource[indexPath.row]).plattask_id,
//                                  @"ownerId":((PlatWaitModel *)_dataSource[indexPath.row]).owner_id,
//                                  @"taskId":((PlatWaitModel *)_dataSource[indexPath.row]).task_id};
//            [AvailableNetWorking postWithUrl:[YhxUtility replaceTypePath:platChangeRed_connector] params:dic successHandler:^(id responseObject) {
//                
//                if ([responseObject[@"code"] intValue] == 200) {
//                    if (_dataSource.count > 8) {
//                        [_dataSource removeAllObjects];
//                        [self.tableView reloadData];
//                        _currentPage = 1;
//
//                    }
//                    NSDictionary *dic = @{@"pageSize":@"8",
//                                          @"pageNum":@"1"};
//                    _task_wait_readDetail = [_networkTool getPlatOrderListDataWithParam:dic];
//
//                }
//            } falureHandler:^(NSError *error) {
//
//            }];
//        }
//    }
//}
//
//-(void)viewDidLayoutSubviews {
//    if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
//        [self.tableView setSeparatorInset:UIEdgeInsetsZero];
//
//    }
//    if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)])  {
//        [self.tableView setLayoutMargins:UIEdgeInsetsZero];
//    }
//}
//
//#pragma mark ---------- Mjrefresh -------------
//- (void)loadNewTopic{
//
//    //来自团队
//    if (orderSingleton.segementIndex == 0) {
//        _currentPage = 1;
//        NSDictionary *dic = @{@"pageSize":@"8",@"pageNum":@"1"};
//        _task_wait_loadNewData = [_networkTool getOrderListDataWithParam:dic];
//        [self.tableView.mj_header endRefreshing];
//    }
//    else{
//        //来自平台的
//        if (orderSingleton.isPoolTranslator == 0) {
//            [_dataSource removeAllObjects];
//            [self.tableView reloadData];
//            [self.tableView addSubview:self.label];
//            self.tableView.separatorColor = RGB(233, 233, 233, 1);
//            [self.view_data_nil removeFromSuperview];
//            [self.text_data_nil removeFromSuperview];
//            [self.tableView addSubview:self.view_data_nil];
//            [self.tableView.mj_header endRefreshing];
//
//        }else{
//            _currentPage = 1;
//            NSDictionary *dic = @{@"pageSize":@"8",
//                                  @"pageNum":@"1"};
//            _task_wait_loadNewData = [_networkTool getPlatOrderListDataWithParam:dic];
//        }
//    }
//}
//
//- (void)loadMoreTopic{
//
//    if (orderSingleton.segementIndex == 0) {
//        _currentPage += 1;
//        NSString *currentPage = [NSString stringWithFormat:@"%ld",(long)_currentPage];
//        NSDictionary *dic = @{@"pageSize":@"8",@"pageNum":currentPage};
//        _task_wait_loadMoreData = [AvailableNetWorking postWithUrl:[YhxUtility replaceTypePath:orderList_connector] params:dic successHandler:^(id responseObject) {
//            TGLog(@"---------%@",responseObject);
//            if ([responseObject[@"code"] intValue] == 200) {
//                if (((NSArray *)responseObject[@"result"]).count > 0) {
//
//                    for (int i = 0; i < ((NSArray *)responseObject[@"result"]).count; i++) {
//                        NSDictionary *dic = ((NSArray *)responseObject[@"result"])[i];
//                        TeamWaitModel *model = [[TeamWaitModel alloc]initWithDictionary:dic];
//                        model.indexPath_row = i + [[NSString stringWithFormat:@"%ld",(unsigned long)_dataSource.count] intValue];
//                        model.OrderTotelCount = ((NSArray *)_networkTool.orderList).count + _dataSource.count;
//                        [_dataSource addObject:model];
//                    }
//                    [self.tableView reloadData];
//                    [self.tableView.mj_footer endRefreshing];
//                }else{
//                    [TopAlertView SetUpbackgroundColor:mainColor andStayTime:2.0 andImageName:@"imagePlaceholder" andTitleStr:@"已经加载完全部数据" andTitleColor:[UIColor whiteColor] andCancel:NO];
//                    _currentPage -= 1;
//                    [self.tableView.mj_footer endRefreshing];
//                }
//            }
//            else{
//                _currentPage -= 1;
//                [self.tableView.mj_footer endRefreshing];
//                [TopAlertView SetUpbackgroundColor:AlertRedColor andStayTime:2.0 andImageName:@"imagePlaceholder" andTitleStr:responseObject[@"message"] andTitleColor:[UIColor whiteColor] andCancel:NO];
//            }
//        } falureHandler:^(NSError *error) {
//
//            _currentPage -= 1;
//            [self.tableView.mj_footer endRefreshing];
//        }];
//
//    }
//    else{
//        _currentPage += 1;
//        NSString *currentPage = [NSString stringWithFormat:@"%ld",(long)_currentPage];
//        NSDictionary *dic = @{@"pageSize":@"8",
//                              @"pageNum":currentPage};
//        _task_wait_loadMoreData = [AvailableNetWorking postWithUrl:[YhxUtility replaceTypePath:platWaitOrderList_connector] params:dic successHandler:^(id responseObject) {
//            TGLog(@"---------%@",responseObject);
//            if ([responseObject[@"code"] intValue] == 200) {
//                if (((NSArray *)responseObject[@"result"]).count > 0) {
//
//                    for (int i = 0; i < ((NSArray *)responseObject[@"result"]).count; i++) {
//                        NSDictionary *dic = responseObject[@"result"][i];
//                        PlatWaitModel *model = [[PlatWaitModel alloc]initWithDictionary:dic];
//                        [_dataSource addObject:model];
//                    }
//                    [self.tableView reloadData];
//                    [self.tableView.mj_footer endRefreshing];
//                }
//                else{
//
//                    _currentPage -= 1;
//                    [TopAlertView SetUpbackgroundColor:mainColor andStayTime:2.0 andImageName:@"imagePlaceholder" andTitleStr:@"已经加载完全部数据" andTitleColor:[UIColor whiteColor] andCancel:NO];
//                    [self.tableView.mj_footer endRefreshing];
//                }
//            }
//            else{
//                
//                _currentPage -= 1;
//                [self.tableView.mj_footer endRefreshing];
//                [TopAlertView SetUpbackgroundColor:AlertRedColor andStayTime:2.0 andImageName:@"imagePlaceholder" andTitleStr:responseObject[@"message"] andTitleColor:[UIColor whiteColor] andCancel:NO];
//            }
//        } falureHandler:^(NSError *error) {
//
//            _currentPage -= 1;
//            [self.tableView.mj_footer endRefreshing];
//        }];
//    }
//}
//
//- (void)hiddenYHXLoadingAnimation{
//    
//    [LSProgressHUD hiddenLoading:self.view];
//}
//
//
//#pragma mark -- 判断数据是否为空
//- (void)judgeDataIsNilOfOrderList{
//
//    if (_dataSource.count == 0) {
//        self.tableView.separatorColor = [UIColor clearColor];
//        if (orderSingleton.segementIndex == 0) {
//            self.view_data_nil.image = [UIImage imageNamed:@"任务"];
//            self.text_data_nil.text = @"暂时没有合适你的任务";
//            [self.tableView addSubview:self.view_data_nil];
//            [self.tableView addSubview:self.text_data_nil];
//        }
//        else{
//            if (orderSingleton.isPoolTranslator == 0) {
//                self.tableView.separatorColor = [UIColor clearColor];
//                [self.tableView addSubview:self.view_data_nil];
//                [self.tableView addSubview:self.label];
//            }
//            else{
//                self.view_data_nil.image = [UIImage imageNamed:@"任务"];
//                self.text_data_nil.text = @"暂时没有合适你的任务";
//                [self.tableView addSubview:self.view_data_nil];
//                [self.tableView addSubview:self.text_data_nil];
//            }
//        }
//    }
//    else{
//        if (self.view_data_nil) {
//            self.tableView.separatorColor = RGB(233, 233, 233, 1);
//            [self.view_data_nil removeFromSuperview];
//            [self.text_data_nil removeFromSuperview];
//        }
//        if (self.label) {
//            [self.label removeFromSuperview];
//        }
//    }
//}
//
//- (void)judgeDataIsNilOfOrderIngList{
//
//    if (_dataSource.count == 0) {
//        self.tableView.separatorColor = [UIColor clearColor];
//        if (orderSingleton.segementIndex == 0) {
//            self.view_data_nil.image = [UIImage imageNamed:@"任务"];
//            self.text_data_nil.text = @"暂时没有进行中的任务";
//            [self.tableView addSubview:self.view_data_nil];
//            [self.tableView addSubview:self.text_data_nil];
//
//        }else{
//            self.view_data_nil.image = [UIImage imageNamed:@"任务"];
//            self.text_data_nil.text = @"暂时没有进行中的任务";
//            [self.tableView addSubview:self.view_data_nil];
//            [self.tableView addSubview:self.text_data_nil];
//        }
//    }
//    else{
//        if (self.view_data_nil) {
//            self.tableView.separatorColor = RGB(233, 233, 233, 1);
//            [self.view_data_nil removeFromSuperview];
//            [self.text_data_nil removeFromSuperview];
//        }
//        if (self.label) {
//            [self.label removeFromSuperview];
//        }
//    }
//
//}
//
//
//
////取消网络任务
//- (void)cancelLastSessionTask{
//
//    TGLog(@"取消来自客户里的请求");
//    [_dataSource removeAllObjects];
//    [self.tableView reloadData];
//    [_task_wait_firstLoad cancel];
//    [_task_wait_becomeUpdate cancel];
//    [_task_wait_loadNewData cancel];
//    [_task_wait_loadMoreData cancel];
//    [_task_wait_historyOrder cancel];
//    [_task_wait_changeSegement cancel];
//    [_task_wait_readDetail cancel];
//}
//
////注销登录时，清空本地数据
//- (void)cleanAllCache{
//
//    //删除本地账号密码
//    [UserDefaults removeObjectForKey:@"account"];
//    [UserDefaults removeObjectForKey:@"password"];
//    [UserDefaults setBool:NO forKey:@"unreadMessage"];
//    orderSingleton.historyCount = 0;
//    shareData.loginByLoginViewcontroller = NO;
//}
//
//- (void)clearDataWhenLoginoutSuccess{
//
//    [self.view_data_nil removeFromSuperview];
//    [self.text_data_nil removeFromSuperview];
//    [self.label removeFromSuperview];
//    [_dataSource removeAllObjects];
//    [self.tableView reloadData];
//}
//
//#pragma mark -- getter
//- (UITableView *)tableView{
//
//    if (!_tableView) {
//        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 16*3-40+10-NAVIGATION_EXCURSION, Screen_Width, Screen_Height-64-16*3-10-tableview_lessen_height) style:UITableViewStylePlain];
//        _tableView.backgroundColor = RGB(245, 246, 247, 1);
//        _tableView.dataSource = self;
//        _tableView.delegate = self;
//        _tableView.separatorColor = [UIColor clearColor];
//    }
//    return _tableView;
//}
//
//- (UIImageView *)view_data_nil{
//
//    if (!_view_data_nil) {
//        _view_data_nil = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, Screen_Width/2+50*Radio, Screen_Width/2)];
//        _view_data_nil.image = [UIImage imageNamed:@"任务"];
//        _view_data_nil.center = CGPointMake(self.view.center.x, Screen_Height/4);
//    }
//    return _view_data_nil;
//}
//
//- (UILabel *)text_data_nil{
//
//    if (!_text_data_nil) {
//        _text_data_nil = [[UILabel alloc]initWithFrame:CGRectMake(0, _view_data_nil.frame.origin.y+_view_data_nil.frame.size.height+20*Radio, Screen_Width, 30)];
//        _text_data_nil.backgroundColor = [UIColor clearColor];
//        _text_data_nil.text = @"暂时没有合适您的任务";
//        _text_data_nil.font = [UIFont systemFontOfSize:FLEXIBLE(18)];
//        _text_data_nil.textColor = [UIColor grayColor];
//        _text_data_nil.textAlignment = NSTextAlignmentCenter;
//    }
//    return _text_data_nil;
//}
//
//- (UILabel *)label{
//
//    if (!_label) {
//        _label = [[UILabel alloc]initWithFrame:CGRectMake(30, 0, Screen_Width-60, 130)];
//        _label.center = CGPointMake(self.tableView.center.x, self.tableView.center.y+50*Radio);
//        _label.backgroundColor = [UIColor clearColor];
//        _label.textColor = RGB(128, 128, 128, 1);
//        _label.font = [UIFont systemFontOfSize:FLEXIBLE(16)];
//        _label.textAlignment = NSTextAlignmentCenter;
//        _label.numberOfLines = 0;
//        _label.text = @"您不是译马网人才库的成员，不能承接来自平台的稿件。若有意加入译马网人才库，请先申请成为认证译员，方法是：登录网页端，前往【我的账号】>【翻译信息】，点击语言对上的“申请认证”按钮，即可申请认证。";
//    }
//    return _label;
//}
//
@end
//
//

